package com.starnet.studentmanagement.util;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.starnet.studentmanagement.vo.PageVO;

public class PageUtil {
    public static PageVO getPageVO(IPage page){
        PageVO pageVO = new PageVO();
        pageVO.setCur(page.getCurrent());
        //当前页面尺寸
        pageVO.setSize(page.getSize());
        //总记录数
        pageVO.setTotalRecords(page.getTotal());
        //算出总页面
        pageVO.setTotalPages((long) Math.ceil((double) page.getTotal()/(double) page.getSize()));
        return pageVO;
    }
}
